package cn.wolfcode.luowowo.redis.util;

import cn.wolfcode.luowowo.util.Consts;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

@Getter
public enum  RedisKeys {
    //用户攻略收藏统计的key对象实例
    USER_STRATEGY_FAVOR("user_strategy_favor", -1l),  //-1表示不设定超时
    //攻略统计的key对象实例
    STRATEGY_STATIS_VO("strategy_statis_vo", -1l),  //-1表示不设定超时
    VERIFY_TOKEN("verify_token",Consts.USER_INFO_TOKEN_VAI_TIME*60L),
    VERIFY_CODE("verify_code", Consts.VERIFY_CODE_VAI_TIME*60L);
    //信息头前缀
    private String head;
    //生存时间
    private Long time;
    //构造器
    private RedisKeys(String head, Long time){
        this.head = head;
        this.time = time;
    }
    //被调用参数的方法
    public String join(String...value){
        StringBuilder builder = new StringBuilder(80);
        builder.append(this.head);
        for (String s:value) {
            builder.append(":").append(s);
        }
        return builder.toString();
    }

}
